<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% 
    String context = request.getContextPath();
    request.setAttribute("context",context);
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>用户</title>
    <script src="${context}/static/jquery-easyui-1.3.2/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="${context}/static/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="${context}/static/scripts/json2.js" type="text/javascript"></script>
    <script src="${context}/static/scripts/common.js" type="text/javascript"></script>
	<link rel="stylesheet" href="${context}/static/kindeditor-4.1.7/themes/default/default.css" />
	<link rel="stylesheet" href="${context}/static/kindeditor-4.1.7/plugins/code/prettify.css" />
	<script charset="utf-8" src="${context}/static/kindeditor-4.1.7/kindeditor.js"></script>
	<script charset="utf-8" src="${context}/static/kindeditor-4.1.7/lang/zh_CN.js"></script>
	<script charset="utf-8" src="${context}/static/kindeditor-4.1.7/plugins/code/prettify.js"></script>    
    
<head>
<style type="text/css">


</style>
   
<script type="text/javascript">

	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="content"]', {
			cssPath : '${context}/static/kindeditor-4.1.7/plugins/code/prettify.css',
			uploadJson : '${context}/static/kindeditor-4.1.7/jsp/upload_json.jsp',
			fileManagerJson : '${context}/static/kindeditor-4.1.7/jsp/file_manager_json.jsp',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
			}
		});
		prettyPrint();
	});


</script>    

</head>
<body>

<form name="example" method="post" action="${context}/wread/addItem.html">
	<input name="id" type="hidden"></input>
	<textarea name="content" cols="100" rows="8" style="width:100%;height:500px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
	<br />
	<input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
</form>
<%!
	private String htmlspecialchars(String str) {
		str = str.replaceAll("&", "&amp;");
		str = str.replaceAll("<", "&lt;");
		str = str.replaceAll(">", "&gt;");
		str = str.replaceAll("\"", "&quot;");
		return str;
	}
%>	
</body>
</html>
